package com.harmontronics.hanma.paas.paas.domain.app.repository.persistence;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.harmontronics.hanma.paas.paas.domain.app.entity.valueobject.Fields;
import com.harmontronics.hanma.paas.paas.domain.app.repository.mapper.HmScriptMapper;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmEntityModelPO;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmScriptPO;
import org.springframework.stereotype.Repository;


@Repository("hmScriptRepository")
public class HmScriptRepository extends ServiceImpl<HmScriptMapper, HmScriptPO> {

    public IPage<HmScriptPO> selectPage(QueryWrapper<HmScriptPO> queryWrapper, Page<HmScriptPO> page) {
        return baseMapper.selectPage(page, queryWrapper);
    }

    public HmScriptPO findByName(String name) {
        QueryWrapper<HmScriptPO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(Fields.NAME,name);
        return baseMapper.selectOne(queryWrapper);
    }

    public HmScriptPO findByCode(String code) {
        QueryWrapper<HmScriptPO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(Fields.CODE,code);
        return baseMapper.selectOne(queryWrapper);
    }
}